
/**
 * 
 */

import Alert from './Alert';
const { ccclass, property } = cc._decorator;

@ccclass
export default class Alert1 extends Alert {


	@property(cc.Label)
	titleLab: cc.Label = null;
	// @property(cc.Label)
	// cancelLb: cc.Label = null;
	// @property(cc.Label)
	// confirmLb: cc.Label = null;
	@property(cc.RichText)
	lab_richTextcontent: cc.Label = null;

	// @property(cc.Node)
	// shu: cc.Node = null;



	onLoad() {

	}
	onEnable() {
		// cc.vv.syskeyMgr.putCloseCallBack(this.onClickBack.bind(this), this);
	}
	onDisable() {
		// cc.vv.syskeyMgr.rmvCloseCallBack(this);
	}
	onDestroy() {

	}

	/**
	 * 富文本设置
	 */
	private setcontentStates(flag: boolean): void {
		this.content.node.active = !flag
		this.lab_richTextcontent.node.active = flag
		if (flag)
			this.lab_richTextcontent.string = this.content.string
	}

	init(args) {
		//	LingShu
		super.init(args);
		var onCancel = null;
		var title = "";
		let isUsetRichText: boolean = false
		switch (args.length) {

			case 3:
				onCancel = args[2];
				break;
			case 4:
				onCancel = args[2];
				title = args[3];
				break;
			case 5:
				onCancel = args[2];
				title = args[3];

				this.confirmLb.string = args[4] || this.confirmLb.string;
				break;
			case 6:
				onCancel = args[2];
				title = args[3];
				// this.confirmLb.string = args[4] || this.confirmLb.string;
				// this.cancelLb.string = args[5] || this.cancelLb.string;
				break;
			case 7:
			case 8:
				onCancel = args[2];
				title = args[3];
				// this.confirmLb.string = args[4] || this.confirmLb.string;
				// this.cancelLb.string = args[5] || this.cancelLb.string;
				this.node.getChildByName("Bg").y = args[6] || this.node.getChildByName("Bg").y;
				isUsetRichText = args[7]
				break;
		}
		this.setcontentStates(isUsetRichText)
		this.titleLab.string = title;
		// this.shu.active = false;
		// if (onCancel) {
		// 	this.shu.active = true;
		// }
		// args[4] && (this.confirmLb.string = args[4]);
		// args[5] && (this.cancelLb.string = args[5]);
	}


	close() {
		cc.vv.UIMgr.close(cc.vv.GLConfig.alert1_path, cc.vv.UIMgr.closeType.destory);
	}




}
